package experiment6;

public class No_3 {
    public static void main(String []args){
        Rectangle rectangle=new Rectangle(3,4);
        Cuboid cuboid=new Cuboid(3,4,5);
        System.out.println("长方体的底面积是"+cuboid.getArea());
        System.out.println("长方体的体积是"+cuboid.getVolume());
    }


}

class Rectangle{
    public double length;
    public double width;
    public Rectangle(double length,double width){
        this.length=length;
        this.width=width;
    }
    public double getArea(){
        return (length*width)/2;
    }
}

class Cuboid extends Rectangle{
    public double height;

    public Cuboid(double length, double width,double height) {
        super(length, width);
        this.height=height;
    }

    public double getVolume(){
        return height*length*width;
    }

}